package net.lanelife.casino.cms.web.controller;

import java.util.List;

import javax.servlet.ServletRequest;

import net.lanelife.casino.caipiao.dto.admin.LoginLogDTO;
import net.lanelife.casino.caipiao.dto.admin.LoginLogTable;
import net.lanelife.casino.caipiao.entity.LoginLog;
import net.lanelife.casino.caipiao.service.api.ILoginLogService;
import net.lanelife.casino.cms.web.controller.support.CRUDController;
import net.lanelife.casino.cms.web.controller.support.UserSearchFilter;
import net.lanelife.casino.common.dto.support.GenericDTO;
import net.lanelife.casino.common.repository.SearchFilter;
import net.lanelife.casino.common.service.support.IGenericService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = LoginLogController.PATH)
public class LoginLogController extends CRUDController<LoginLog, Integer, LoginLogDTO, GenericDTO<Integer>, GenericDTO<Integer>, LoginLogTable<LoginLogDTO>> {
	
	public static final String PATH = "/login-log";
	
	public LoginLogController() {
		super(PATH);
	}

	@Autowired
	private ILoginLogService loginLogService;
	
	@Autowired
	private UserSearchFilter userSearchFilter;
	
	@Override
	protected IGenericService<LoginLog, Integer> getService() {
		return loginLogService;
	}
	
	@Override
	protected void postList(Model model, Pageable pageable, ServletRequest request, List<SearchFilter> filters) throws Exception {
		userSearchFilter.buildSearchFilter(filters, request);
	}

}
